package com.family.system.custom;

import com.family.common.utils.MD5;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.password.PasswordEncoder;


/**
 * @ClassName CustomMd5PasswordEncoder
 * @Date 2023-05-13 11:00
 * @AUTHOR family
 **/
@Configuration
public class CustomMd5PasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {
        return MD5.encrypt(rawPassword.toString());
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals((MD5.encrypt(rawPassword.toString())));
    }
}
